package com.mgm.controller;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.springframework.web.multipart.MultipartFile;

import com.mgm.pojo.User;

public class BaseController {
	
	protected User getCurUser() {
		User user = new User();
		user.setId(1);
		user.setName("admin");
		return user;
	}
	
	public File convertFile(MultipartFile file) throws IOException {
		File convFile = new File(file.getOriginalFilename());
		convFile.createNewFile();
		FileOutputStream fos = new FileOutputStream(convFile);
		fos.write(file.getBytes());
		fos.close();
		return convFile;
	}

}
